package com.zhuss.controller.core;

import com.zhuss.bean.bo.core.company.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.core.company.CompanyOperateServiceExt;
import com.zhuss.exception.DzcxException;


/**
 * 公司操作 controller
 * @Author zhushanshuo
   @Date 2020-02-04 22:58
 *
 */


@RestController
@RequestMapping("/company")
public class CompanyOperateController extends BaseController {

	@Autowired
	@Qualifier("companyOperateService")
	private OperateService<Void, Object> companyOperateService;

	@Autowired
	@Qualifier("companyOperateServiceExt")
	private CompanyOperateServiceExt companyOperateServiceExt;

	/**
	 * 创建
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateCompanyBo bo) throws DzcxException {

		companyOperateService.create(bo);
    }


	/**
	 * 修改
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateCompanyBo bo) throws DzcxException {

		companyOperateService.update(bo);
    }

	/**
	 * 删除
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteCompanyBo bo) throws DzcxException {

		companyOperateService.delete(bo);
    }

	/**
	 * 启用
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/start")
	public void start(@RequestBody StartCompanyBo bo) throws DzcxException {

		companyOperateServiceExt.start(bo);
	}

	/**
	 * 停用
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/stop")
	public void stop(@RequestBody StopCompanyBo bo) throws DzcxException {

		companyOperateServiceExt.stop(bo);
	}



	/**
	 * 创建部门
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/createDept")
    public void createDept(@RequestBody CreateDeptBo bo) throws DzcxException {

		companyOperateServiceExt.createDept(bo);
    }


	/**
	 * 修改部门
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/updateDept")
    public void updateDept(@RequestBody UpdateDeptBo bo) throws DzcxException {

		companyOperateServiceExt.updateDept(bo);
    }

	/**
	 * 删除部门
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/deleteDept")
    public void deleteDept(@RequestBody DeleteDeptBo bo) throws DzcxException {

		companyOperateServiceExt.deleteDept(bo);
    }




}
